import { Get, Post, geoserver, swagger, weather } from "./index";

export function getYXQYidData(params) {
  return Get(
    geoserver +
      `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:yxqu&maxFeatures=5000&outputFormat=application/json&cql_filter=${params}`
  );
}
// 获取所有管线
export function getpolyLineData() {
  return Get(
    geoserver +
      `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:gx&outputFormat=application/json`
  );
}
// export function getpolyLineData () {
//   return Get(
//     geoserver +
//     `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:012&outputFormat=application/json`
//   );
// }
// export function getpolyLineData1 () {
//   return Get(
//     geoserver +
//     `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:345&outputFormat=application/json`
//   );
// }
// export function getpolyLineData() {
//   return Get(
//     `/geoserver` +
//       `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:test&outputFormat=application/json`
//   );
// }

// 获取所有的图标
export function getpolyPointData() {
  return Get(
    geoserver +
      `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:point&outputFormat=application/json`
  );
}
// 获取行政区划
export function getpolyxzqhData() {
  return Get(
    geoserver +
      `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:安定区乡镇界&outputFormat=application/json`
  );
}

// 获取漫游路线
export function getmanyouData() {
  return Get(
    geoserver +
      `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:漫游路径&outputFormat=application/json`
  );
}

//空间分析阀门
export function getBoxPointData(params) {
  return Get(
    geoserver +
      `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:point&maxFeatures=5000&outputFormat=application/json&cql_filter=${params}`
  );
}
//空间分析管线
export function getBoxLineData(params) {
  return Get(
    geoserver +
      `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:gx&maxFeatures=5000&outputFormat=application/json&cql_filter=${params}`
  );
}
//获取管线详细信息
// export function getLineData(params) {
//   return Get(
//     `/geoserver` +
//       `/geoserver/ANDINGQU/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ANDINGQU:gx&maxFeatures=5000&outputFormat=application/json&cql_filter=${params}`
//   );
// }

//联通分析管线
export function getshortPathData(params) {
  return Get(swagger + `/adgw/shortPath?x1=${params[0]}&y1=${params[1]}`);
}

//爆管分析管线（获取阀门id）
export function getburstAnalysisData(params) {
  return Get(swagger + `/adgw/bgFenxi?source=${params}`,'','爆管分析管线');
}

// 漫游管线列表
export function getDLineData(params) {
  return Get(swagger + `/adgw/getDList?grades=${params}`);
}
//
// 根据类型查询漫游管线
export function getMyLineData(params) {
  return Get(swagger + `/adgw/getMyLine?grade=${params}`);
}

// 关阀分析--找出所有影响阀门(管段数据)
export function getgffxData(params) {
  return Get(swagger + `/adgw/gffx?source=${params}`);
}
// // 爆管影响管段
// export function getselByIdData (params) {
//   return Get(
//     `/swagger` +
//     `/adgw/selById?id=${params}`
//   );
// }

//爆管分析管线（获取阀门id）
export function getLonlatbyId(params) {
  return Get(swagger + `/adgw/getXy?device_id=${params}`);
}

export function getGuanxianList() {
  return Post(
    `/fuwuqi` + `/dxny/aPictureSys/ap/getChanList`,
    "",
    "获取管线列表"
  );
}

// export function getToken(parameter={}) {
//   return Get(
//     swagger+
//     `/adgw/login`,
//     "",
//     "获取token"
//   );
// }
export function getToken(parameter) {
  return Get(swagger + `/token/getToken?account=${parameter.account}&password=${parameter.password}`, );
}

// 获取天气信息
export function getWeatherInfo() {
  const url = `${weather}api/v1/weather?district_id=621102&data_type=now`;
  return Get(url);
}
